{% extends "front/Base.html" %}
{% block title %}
   <title>图书列表</title>
{% endblock %}

{% block body %}
    <div class="container-fluid offset-2 d-inline-block">
        <div class="row">
             <div class="list-group col-6">
                {% for book in books %}
                    <a href="{{url_for("front.book_detail",book_id=book.id)}}" class="list-group-item list-group-item-action ">
                        <div class="d-flex w-100 justify-content-between">
                          <p class="mb-1"> {{ book.name}}</p>
                          <small>{{ book.board.name}}</small>
                        </div>
                        <p class="mb-1">作者:{{ book.author_name }}</p>
                        <small>入馆时间:{{ book.create_time }}
                                {% if book.is_borrowed  %}
                                    <span class="text-danger">该书已被借阅,暂未归还</span>
                                {% endif %}
                        </small>
                    </a>
                {% endfor %}
              {{ pagination.links }}
            </div>
             <div class=" col-2">
                <div class="list-group">
                <a class="list-group-item" href="{{ url_for("front.index") }}">所有数据</a>
                    {% for board in boards %}
                        {% if current_board_id==board.id %}
                            <a href="{{ url_for("front.index",board_id=board.id) }}"
                               class="list-group-item list-group-item-action active">
                                {{ board.name}}
                            </a>
                         {% else %}
                            <a href="{{ url_for("front.index",board_id=board.id) }}"
                               class="list-group-item list-group-item-action">
                                {{ board.name}}
                            </a>
                        {% endif %}

                    {% endfor %}

                </div>
            </div>
        </div>

    </div>
{% endblock %}
